package fly.text;

import fly.help.ArraySupport;
import fly.help.PrintSupport;

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

public class DateFormatAbsDemo {

    public static void main(String[] args) {
        PrintSupport.sout("1");

        DateFormat df = DateFormat.getDateInstance();
        Date dt = new Date();
        System.out.println(dt.toString());
        System.out.println(
                df.format(dt )
        );

        PrintSupport.sout("2");
        DateFormat dft = DateFormat.getDateInstance(DateFormat.LONG, Locale.CHINA);
        System.out.println(
                dft.format(dt)
        );

        PrintSupport.sout("3");
        System.out.println( DateFormat.DATE_FIELD);
        System.out.println( DateFormat.DAY_OF_WEEK_FIELD);
        System.out.println( DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
        System.out.println( DateFormat.DAY_OF_YEAR_FIELD);

        PrintSupport.sout("4");
        System.out.println(
                ArraySupport.toString(
                        DateFormat.getAvailableLocales()
                )
        );

        PrintSupport.sout("5");
        System.out.println(
                df.getCalendar().toString()
        );
        System.out.println(
                df.getTimeZone().toString()
        );

        PrintSupport.sout("6");
        DateFormat dftt = DateFormat.getTimeInstance();
        System.out.println( dftt.toString() );
        System.out.println( dftt.getNumberFormat().toString() );
        System.out.println( dftt.format(new Date()));
    }
}

/*
************* demo 1 *************

Mon Dec 31 21:31:30 CST 2018
Dec 31, 2018

************* demo 2 *************

2018年12月31日

************* demo 3 *************

3
9
11
10

************* demo 4 *************

length: 160
;	ar_AE;	ar_JO;	ar_SY;	hr_HR;	fr_BE;	es_PA;	mt_MT;	es_VE;	bg;	zh_TW;	it;	ko;	uk;	lv;	da_DK;	es_PR;	vi_VN;	en_US;	sr_ME;	sv_SE;	es_BO;	en_SG;	ar_BH;	pt;	ar_SA;	sk;	ar_YE;	hi_IN;	ga;	en_MT;	fi_FI;	et;	sv;	cs;	sr_BA_#Latn;	el;	uk_UA;	hu;	fr_CH;	in;	es_AR;	ar_EG;	ja_JP_JP_#u-ca-japanese;	es_SV;	pt_BR;	be;	is_IS;	cs_CZ;	es;	pl_PL;	tr;	ca_ES;	sr_CS;	ms_MY;	hr;	lt;	es_ES;	es_CO;	bg_BG;	sq;	fr;	ja;	sr_BA;	is;	es_PY;	de;	es_EC;	es_US;	ar_SD;	en;	ro_RO;	en_PH;	ca;	ar_TN;	sr_ME_#Latn;	es_GT;	sl;	ko_KR;	el_CY;	es_MX;	ru_RU;	es_HN;	zh_HK;	no_NO_NY;	hu_HU;	th_TH;	ar_IQ;	es_CL;	fi;	ar_MA;	ga_IE;	mk;	tr_TR;	et_EE;	ar_QA;	sr__#Latn;	pt_PT;	fr_LU;	ar_OM;	th;	sq_AL;	es_DO;	es_CU;	ar;	ru;	en_NZ;	sr_RS;	de_CH;	es_UY;	ms;	el_GR;	iw_IL;	en_ZA;	th_TH_TH_#u-nu-thai;	hi;	fr_FR;	de_AT;	nl;	no_NO;	en_AU;	vi;	nl_NL;	fr_CA;	lv_LV;	de_LU;	es_CR;	ar_KW;	sr;	ar_LY;	mt;	it_CH;	da;	de_DE;	ar_DZ;	sk_SK;	lt_LT;	it_IT;	en_IE;	zh_SG;	ro;	en_CA;	nl_BE;	no;	pl;	zh_CN;	ja_JP;	de_GR;	sr_RS_#Latn;	iw;	en_IN;	ar_LB;	es_NI;	zh;	mk_MK;	be_BY;	sl_SI;	es_PE;	in_ID;	en_GB;

************* demo 5 *************

java.util.GregorianCalendar[time=1546263090318,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Shanghai",offset=28800000,dstSavings=0,useDaylight=false,transitions=19,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=11,WEEK_OF_YEAR=1,WEEK_OF_MONTH=6,DAY_OF_MONTH=31,DAY_OF_YEAR=365,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=5,AM_PM=1,HOUR=9,HOUR_OF_DAY=21,MINUTE=31,SECOND=30,MILLISECOND=318,ZONE_OFFSET=28800000,DST_OFFSET=0]
sun.util.calendar.ZoneInfo[id="Asia/Shanghai",offset=28800000,dstSavings=0,useDaylight=false,transitions=19,lastRule=null]

************* demo 6 *************

java.text.SimpleDateFormat@8400729
java.text.DecimalFormat@674dc
9:31:30 PM
 */